﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SpreadSheetViewer.Helper
{
	public static class DirectoryManagmentUtils
	{
		public static string DocumentBrowsingFolderPath { get { return System.IO.Path.Combine(DirectoryManagmentUtils.CurrentDataDirectory, "DocumentBrowsing"); } }
		public static string CurrentDataDirectory
		{
			get
			{
				//if (!Utils.IsSiteMode)
				//	return InitialDemoFilesPath;
				//lock (modifyUserDirectoriesLocker)
				//{
				//	var currentDataDirectory = (string)Context.Session[FolderKey];
				//	DemoDirectoryInfo directoryInfo = ActualDemoDirectories.Where(i => i.Name == currentDataDirectory).SingleOrDefault();
				//	if (directoryInfo == null || ((string)Context.Session[DemoPathKey] != Context.Request.Path && Context.Request.HttpMethod == "GET"))
				//	{
				//		Context.Session[DemoPathKey] = Context.Request.Path;
				//		Context.Session[FolderKey] = currentDataDirectory = CreateNewDemoFolder();
				//		directoryInfo = new DemoDirectoryInfo { Name = currentDataDirectory, LastUsageTime = DateTime.Now };
				//		ActualDemoDirectories.Add(directoryInfo);
				//	}
				//	else
				//	{
				//		directoryInfo.LastUsageTime = DateTime.Now;
				//	}
				//	return currentDataDirectory;
				//}
				return System.Web.HttpContext.Current.Server.MapPath("~/App_Data/Documents/");
			}
		}
	}
}